package cn.wolfcode.luowowo.redis.util;

import cn.wolfcode.luowowo.util.Consts;
import lombok.Getter;

/**
 *  redis key管理
 */
@Getter
public enum  RedisKeys{
    //防刷
    BRUSH_PROOF("brush_proof",60L),
    //短信验证码
    VERIFY_CODE("verify_code", Consts.VERIFY_CODE_VAI_TIME*60L),
    //登录token
    USER_LOGIN_TOKEN("user_login_token", Consts.USER_INFO_TOKEN_VAI_TIME*60L),
    //攻略的各种点赞等数据
    STRATEGY_STATIS_VO("strategy_statis_vo",-1L),
    //存点赞strategyId的list
    USER_STRATEGY_FAVOR("user_strategy_favor",-1L),
    //顶的标记 一天顶一次存在就是顶过了
    USER_STRATEGY_THUMBUP("user_strategy_thumbup",-1L),
    //顶的标记 一天顶一次存在就是顶过了
    USER_TRAVEL_THUMBUP("user_travel_thumbup",-1L),
    //游记的收藏
    USER_TRAVEL_FAVOR("user_travel_favor",-1L) ,
    //游记的点赞等各种数据
    TRAVEL_STATIS_VO("travel_statis_vo",-1L) ;

    private String prefix;
    private Long time;

    private RedisKeys(String prefix, Long time){
        this.prefix = prefix;
        this.time = time;
    }
    public String join(String ...keys){
        StringBuilder sb = new StringBuilder();

        sb.append(prefix);
        for (String key : keys) {
            sb.append(":").append(key);
        }
        return sb.toString();
    }
}
